package com.example.blogindex.web.Fengin;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xpd.blog.bean.Article;
import com.xpd.blog.bean.Comment;
import com.xpd.blog.bean.Result;
import com.xpd.blog.bean.Typeinfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.List;

@FeignClient(name = "blog-other",fallback = OtherFenginImpl.class)
public interface OtherFengin {
    //得到博客
    @RequestMapping("article/getAllArticle")
    public Result getAllArticle(@RequestBody Article article,
                                @RequestParam int page, @RequestParam int size);
    //得到类别
    @RequestMapping("typeinfo/getAllType")
    List<Typeinfo> getAllType();
    //分页查询类别
    @RequestMapping("typeinfo/getAlltypeBypage")
    public Result getAlltypeBypage(@RequestParam int page,@RequestParam int size,@RequestParam String searchUname);
    //添加类别
    @RequestMapping("typeinfo/addType")
    public Result addType(@RequestParam String searchUname);

    //删除类别
    @RequestMapping("typeinfo/delType")
    public Result delType(@RequestParam int tid);
    //修改类别
    @RequestMapping("typeinfo/updateType")
    public Result updateType(@RequestBody Typeinfo typeinfo);

    //得到访问量最多的五个blog
    @RequestMapping("article/getNewBlog")
    public List<Article> getNewBlog();
    //点击类别查找blog
    @RequestMapping("article/getArtByType")
    public Result getArtByType(@RequestBody Article article, @RequestParam int page, @RequestParam int size,@RequestParam int tid);
    //根据id来查找blog
    @RequestMapping("article/getArtByid")
    public Result  getArtByid(@RequestParam int aid);
    //根据id来查找
    @RequestMapping("article/getAdmire")
    public Result getAdmire(@RequestParam int usid);
    //得到自己的blog
    @RequestMapping("article/getMyBlog")
    public Result getMyBlog(@RequestParam int usid,@RequestParam int page,@RequestParam int size,@RequestParam int status);
    //删除自己的blog
    @RequestMapping("article/delMyBlog")
    public Result delMyBlog(@RequestParam int aid);
    //修改自己的blog
    @RequestMapping("article/updateArticle")
    public Result updateArticle( @RequestBody Article article);
    //通过类别查找
    @RequestMapping("article/getBlogByType")
    public Result getBlogByType(@RequestParam int aid,@RequestParam int tid);


    //后台查找blog
    @RequestMapping("article/getAdminAllArticle")
    public Result getAdminAllArticle(@RequestBody Article article,@RequestParam int page,@RequestParam int size,@RequestParam int tid,@RequestParam String endDate,@RequestParam String startDate,@RequestParam String searchUname);
    //修改blog状态
    @RequestMapping("article/statusByusid")
    public Result statusByusid(@RequestBody Article article,@RequestParam int status);

    //查询有没有关注
    @RequestMapping("fired/guan")
    public Result guan(@RequestParam int usid,@RequestParam int uid);
    //关注博主
    @RequestMapping("fired/guanzhu")
    public Result guanzhu(@RequestParam int usid,@RequestParam int uid);
    //取消关注博主
    @RequestMapping("fired/quguanzhu")
    public Result  quguanzhu(@RequestParam int usid,@RequestParam int uid);
    //查看自己的粉丝
    @RequestMapping("fired/getFans")
    public Result getFans(@RequestParam int usid);
    //查看自己的关注
    @RequestMapping("fired/getAttention")
    public Result getAttention(@RequestParam int usid);
    //查看自己粉丝的详细信息
    @RequestMapping("fired/getAllFans")
    public Result getAllFans(@RequestParam int usid,@RequestParam int page,@RequestParam int size);
    //查看自己关注的人的详细信息
    @RequestMapping("fired/getAllAttention")
    public Result getAllAttention(@RequestParam int usid,@RequestParam int page,@RequestParam int size);
    //查找粉丝数量前六的博主
    @RequestMapping("fired/selectfired")
    public Result selectfired(@RequestParam int usid);

    //根据博客id查找评论
    @RequestMapping("comment/selectByid")
    List<Comment> selectByid(@RequestParam int bid);

    //添加博客评论
    @RequestMapping("comment/insertComment")
    Result insertComment(@RequestBody Comment comment, @RequestParam int usid, @RequestParam int bid);

    //添加blog
    @RequestMapping("article/addArticle")
    Result addArticle( @RequestBody Article article);
    @RequestMapping("article/draftArticle")
    public Result draftArticle(@RequestBody Article article);

    //查询该博主有没有收藏该blog
    @RequestMapping("favorite/selectFav")
    public Result selectFav(@RequestParam int usid,@RequestParam int aid);

    //添加收藏
    @RequestMapping("favorite/addFav")
    public Result addFav(@RequestParam int usid,@RequestParam int aid);

    //删除收藏
    @RequestMapping("favorite/delFav")
    public Result delFav(@RequestParam int usid,@RequestParam int aid);

    //查看自己的收藏
    @RequestMapping("favorite/getFav")
    public Result getFav(@RequestParam int usid, @RequestParam("page")int page, @RequestParam("size")int size);


    //点赞
    @RequestMapping("evaluate/addEvaluate")
    public Result addEvaluate(@RequestParam int usid, @RequestParam int aid,@RequestParam int status);
    //取消点赞
    @RequestMapping("evaluate/delEvaluate")
    public Result delEvaluate(@RequestParam int usid, @RequestParam int aid,@RequestParam int status);
    //查询blog
    @RequestMapping("evaluate/selectEvaluate")
    public Result selectEvaluate(@RequestParam int usid, @RequestParam int aid);
}
